// SliderSelect

@import '../../style/themes/default';
@import '../../style/mixins/index';
@import './param';

@mixin slider-select {
  width: 100%;
  @include flex();
  > label {
    display: inline-block;
    white-space: nowrap;
    height: $--x-slider-select-height;
    line-height: $--x-slider-select-height;
    color: $--x-text-300;
    font-weight: 600;
    @include text-align();
  }
  > .#{$--x-slider-select-prefix}-inner {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    padding-right: $--x-slider-select-button-size;
    > .#{$--x-slider-select-prefix}-rail {
      position: absolute;
      margin-left: $--x-slider-select-button-size/2;
      width: calc(100% - #{$--x-slider-select-button-size});
      background-color: $--x-border-100;
      height: $--x-slider-select-track-height;
      border-radius: $--x-slider-select-border-radius;
      > div {
        width: 100%;
        height: 100%;
      }
    }
    > .#{$--x-slider-select-prefix}-track {
      margin-left: $--x-slider-select-button-size/2;
      width: calc(100% - #{$--x-slider-select-button-size});
      position: absolute;
      > .#{$--x-slider-select-prefix}-process {
        height: $--x-slider-select-track-height;
        background-color: $--x-primary;
        border-radius: $--x-slider-select-border-radius;
        width: 0%;
      }
    }
    > .#{$--x-slider-select-prefix}-drags {
      position: relative;
      width: 100%;
      height: $--x-slider-select-height;
      display: flex;
      align-items: center;
      > .#{$--x-slider-select-prefix}-drag {
        position: absolute;
        left: 0%;
        > .#{$--x-slider-select-prefix}-button {
          width: $--x-slider-select-button-size;
          height: $--x-slider-select-button-size;
          border-radius: $--x-slider-select-button-size;
          border: calc(#{$--x-border-width} * 2) solid $--x-primary;
          background-color: $--x-background-a100;
        }
      }
    }
  }
  &.x-invalid,
  &.x-required {
    > label {
      color: $--x-danger;
    }
    > .#{$--x-slider-select-prefix}-row {
      > #{$--x-prefix}-icon {
        color: $--x-danger;
      }
      &:before {
        content: ' ';
        z-index: 2;
        position: absolute;
        height: $--x-slider-select-height;
        line-height: $--x-slider-select-height;
        border-top-left-radius: $--x-slider-select-border-radius;
        border-bottom-left-radius: $--x-slider-select-border-radius;
        width: 0.125rem;
        background-color: $--x-danger;
      }
    }
  }
  &.x-disabled {
    > .#{$--x-slider-select-prefix}-inner {
      > .#{$--x-slider-select-prefix}-rail {
        background-color: $--x-border-300;
      }
      > .#{$--x-slider-select-prefix}-track {
        > .#{$--x-slider-select-prefix}-process {
          background-color: $--x-primary-400;
        }
      }
      > .#{$--x-slider-select-prefix}-drags {
        > .#{$--x-slider-select-prefix}-drag {
          > .#{$--x-slider-select-prefix}-button {
            border-color: $--x-primary-400;
          }
        }
      }
    }
  }
  &.x-flex {
    &.x-direction {
      &-row {
        > label {
          padding: 0 0.5rem 0 0;
        }
      }
      &-row-reverse {
        > label {
          padding: 0 0 0 0.5rem;
        }
      }
      &-column {
        align-items: inherit;
      }
      &-column-reverse {
        align-items: inherit;
      }
    }
  }
  &-max-length {
    position: absolute;
    font-size: $--x-font-size-small;
    color: $--x-text-500;
    padding: $--x-slider-select-padding;
    right: 0;
  }
}
